using System;
using System.Windows.Forms;

namespace MDSAdministration
{
    public class CompareSystem
    {
        public string Name { get; set; }
        public string Version { get; set; }
        public string RegistrationKey { get; set; }
        public string SchemaVersion { get; set; }

        public MDSVersionDetails VersionDetails
        {
            get
            {
                switch (Convert.ToInt32(Version.Split('.')[0]))
                {
                    case 10:
                        return new MDSVersionDetails() {HasStagingTable = false,
                                                        HasCodeGenSeed = false,
                                                        HasSortOrder = false,
                                                        Version = SqlMDSVersion.Sql2008};
                    case 11:
                        return new MDSVersionDetails() {HasStagingTable = true,
                                                        HasCodeGenSeed = true,
                                                        HasSortOrder = true,
                                                        Version = SqlMDSVersion.Sql2012
                        };
                    case 12:
                        return new MDSVersionDetails() {HasStagingTable = true,
                                                        HasCodeGenSeed = true,
                                                        HasSortOrder = true,
                                                        Version = SqlMDSVersion.Sql2014
                        };
                    default:
                        throw new Exception("Unknown MDS version");

                }
                
            }
        }

        
    }

    public enum SqlMDSVersion
    {
        Sql2008, Sql2012, Sql2014
    }

    public class MDSVersionDetails
    {
        public SqlMDSVersion Version { get; set; }
        public bool HasStagingTable { get; set; }
        public bool HasCodeGenSeed { get; set; }
        public bool HasSortOrder { get; set; }
        
    }

}